import request from '@/router/axios';
import { baseUrl } from '@/config/env';

export const roleList = (query) => request({
    url: baseUrl + '/admin/role/list',
    method: 'get',
    params: query
});

export const saveRole = (data) => request({
    url: baseUrl + '/admin/role/save',
    method: 'post',
    data: data
});

export const updateRole = (data) => request({
    url: baseUrl + '/admin/role/update',
    method: 'put',
    data: data
});

export const deleteRole = (id) => request({
    url: baseUrl + '/admin/role/delete/'+ id,
    method: 'delete',
});

export const saveRoleResources = (roleId,resourcesIds) => request({
    url: baseUrl + '/admin/role/resources',
    method: 'put',
    params: {
        roleId: roleId,
        resourcesIds: resourcesIds
    }
});

